I have been fiddling with a limit switch on Axis2 of the scanner. So far, I have a physical switch on the axis, connected to power pin 24 on J7, and the other side of the switch to pin 7. The switch in Normally Open, so when it is tripped it puts 5v on pin 7. In the digital I/O screen of Kmotion, I see see I/O 0 and 1 toggle state when the switch in pressed.
In the C-Code screen I have tried this code
#include "KMotionDef.h"
main()
{
Jog(2,2000); // start moving
while (ReadBit(0)) ; // wait for switch (input #0) to change
Jog(2,0); // StopMotion
}
In the Config screen, I have Positive Watch Limit checked, and bit 0 selected, with the Action set to Stop Movement. This give me a line in the c code of this: ch2->LimitSwitchOptions=0x22; When this is executed, I get this line repeated over and over in the console screen: "Pos Limit Stop Axis:2"
So far, I don't have it working. What am I doing wrong?
Grace McKay
|